﻿@{
    Layout = "~/Views/Shared/_Layout.cshtml";    
}
<link href="@Url.Content("~/Content/tinybox2.css")" rel="stylesheet" />
<script src="@Url.Content("~/Scripts/tinybox2.js")"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('.TextFileEditor').click(function () {
            var boxWidth = $(window).width() - 50;
            var boxHeight = $(window).height() - 50;
            TINY.box.show({ iframe: '@Url.Action("TextFileEditor", "Home")/' + this.id + '/?isIframe=true', boxid: 'frameless', width: boxWidth, height: boxHeight });
            return false;
        });
        @*$('.TextFileEditorWithPdf').click(function () {
            TINY.box.show({ iframe: '@Url.Action("TextFileEditorWithPdf", "Home")/' + this.id + '/?isIframe=true', boxid: 'frameless', width: 600, height: 600 });
            return false;
        });*@
        $('.TextFileEditor2').click(function () {
            var boxWidth = $(window).width() - 50;
            var boxHeight = $(window).height() - 50;
            TINY.box.show({ iframe: '@Url.Action("TextFileEditor2", "Home")/' + this.id + '/?isIframe=true', boxid: 'frameless', width: boxWidth, height: boxHeight });
            return false;
        });
    });
</script>
<div>
    <p style="width: 100%;color: black;">
        <b>this is what i wanted to create:</b>
    </p>
    <div style="margin-left: 20px;">
        <p>
            <br />
            download the file from here <a href="@Url.Action("DownloadFile", "Files", new { id = "1.xml" })" target="_blank" download>1.xml</a> now edit the file a bit,<br />
            after editing opent the 1.xml iframe popup below,<br />
            - you can either edit the file online or upload the edited file,
            <br />
            - review the changes and save it to the server.
        </p>
        <p style="margin-left: 10px"><a target="_blank" href="@Url.Action("TextFileEditor", "Home", new { id="1.xml", isIframe = false })" class="TextFileEditor" id="1.xml">1.xml</a></p>
        <p style="margin-left: 10px"><a target="_blank" href="@Url.Action("TextFileEditorWithPdf", "Home", new { id="1.xml", isIframe = true })" class="TextFileEditorWithPdf" id="1.xml">1.xml (with pdf)</a></p>
        <p style="margin-left: 10px"><a target="_blank" href="@Url.Action("TextFileEditor2", "Home", new { id="sample_xml_feed_enetpulse_basketball.xml", isIframe = true })" class="TextFileEditor2" id="sample_xml_feed_enetpulse_basketball.xml">sample_xml_feed_enetpulse_basketball.xml diff ver 2</a></p>
        <p style="margin-left: 10px"><a target="_blank" href="@Url.Action("TextFileEditor", "Home", new { id="sample_xml_feed_enetpulse_basketball.xml", isIframe = false })" class="TextFileEditor" id="sample_xml_feed_enetpulse_basketball.xml">sample_xml_feed_enetpulse_basketball.xml</a></p>
        <p style="margin-left: 10px"><a target="_blank" href="@Url.Action("TextFileEditor", "Home", new { id="sample_xml_feed_enetpulse_icehockey.xml", isIframe = false })" class="TextFileEditor" id="sample_xml_feed_enetpulse_icehockey.xml">sample_xml_feed_enetpulse_icehockey.xml</a></p>
        <p style="margin-left: 10px"><a target="_blank" href="@Url.Action("TextFileEditor", "Home", new { id="sample_xml_feed_enetpulse_soccer.xml", isIframe = false })" class="TextFileEditor" id="sample_xml_feed_enetpulse_soccer.xml">sample_xml_feed_enetpulse_soccer.xml</a></p>
        <p style="margin-left: 10px"><a target="_blank" href="@Url.Action("TextFileEditor", "Home", new { id="sample_xml_feed_enetpulse_tennis.xml", isIframe = false })" class="TextFileEditor" id="sample_xml_feed_enetpulse_tennis.xml">sample_xml_feed_enetpulse_tennis.xml</a></p>
    </div>
</div>
<div>
    <p style="width: 100%;color: black;">
        <b>reference links</b>
    </p>
    <div style="margin-left: 20px;">
        <div class="wikidoc">
            Asp.Net MVC 5 Source Text Differences Compare<br>
            <br>
            this project purpose is to create javascript popup that will compare files content like in bitbucket or any other source control.<br>
            <br>
            i came across a need to compare 2 text files (xml) that was uploaded by a workflow,<br>
            after upload we wanted to review the files and edit them.<br>
            <br>
            initially the file was downloaded, modified and uploaded to the same location while overwriting the old one.<br>
            <br>
            we wanted to improve that by being able to review the text file, edit it, compare diffs and save them, and maybe while were at it verify the modified file is a valid xml and some other security issues and logic issues to prevent mistakes.<br>
            <br>
            i dont have much time to work on that, but i thought, hey, it seems like something a lot of people would want...<br>
            <br>
            so enjoy and contribute.<br>
            <br>
            i used code from:<br>
            <a href="https://github.com/arnab/jQuery.PrettyTextDiff">Pretty Text Diff</a> - for the text compare<br>
            <a href="https://github.com/blueimp/jQuery-File-Upload">jQuery File Upload</a> - for the file upload<br>
            <a href="http://codemirror.net/">Code Mirror</a> - for the xml editor<br>
        </div>
    </div>
</div>
